<?php
require_once('funciones/conectaApiMagento.php');
require_once('funciones/MagentoApiMetodos.php');
require_once('funciones/IceCatApi.php');
ob_start();

$especificaciones = getICEcatProductSpecs('4905524838503');
echo $especificaciones;
//exit;
$proxy = ConectaApiMagentoProxy();
$sessionId = ConectaApiMagentoSession($proxy);

print $sessionId;

$result = ProductInfo($proxy,$sessionId,'379');

var_dump($result);
fb($result,'imagen',FirePHP::INFO);
echo $result['name'].'</br>';

$posicion = 2;
//$image_create = MediaCreate($proxy,$sessionId,'images/productos/379aspirador.jpg','379','Imagen2','Imagen2',$posicion);
//var_dump($image_create);

// Newly created image file
echo '*****************************';
$imagen = MediaList($proxy, $sessionId, '379');
fb($imagen,"Imagen",  FirePHP::INFO);
//var_dump(MediaList($proxy, $sessionId, '379'));






$proxy->endSession($sessionId);


//$proxy = new SoapClient('http://magento.agrupalia.net/index.php/api/v2_soap/?wsdl');
//
//$sessionId = $proxy->login((object)array('username' => 'clsard', 'apiKey' => '1995AngelA1123'));
//
//$result = $proxy->catalogProductInfo((object)array('sessionId' => $sessionId->result, 'productId' => '378'));
//var_dump($result->result);
?>
<img width="150px" src="<? echo $imagen[0]['url'];?>" alt="">



<!--    $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
    $sessionId = $proxy->login('apiUser', 'apiKey');
     
    $newImage = array(
        'file' => array(
            'name' => 'file_name',
            'content' => base64_encode(file_get_contents('product.jpg')),
            'mime'    => 'image/jpeg'
        ),
        'label'    => 'Cool Image Through Soap',
        'position' => 2,
        'types'    => array('small_image'),
        'exclude'  => 0
    );
     
    $imageFilename = $proxy->call($sessionId, 'product_media.create', array('Sku', $newImage));
     
     
    var_dump($imageFilename);
     
    // Newly created image file
    var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));
     
    $proxy->call($sessionId, 'product_media.update', array(
        'Sku',
        $imageFilename,
        array('position' => 2, 'types' => array('image') /* Lets do it main image for product */)
    ));
     
    // Updated image file
    var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));
     
    // Remove image file
    $proxy->call($sessionId, 'product_media.remove', array('Sku', $imageFilename));
     
    // Images without our file
    var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));

-->
